home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-16 | 2.6 KB | 74 lines | [TEXT/GEOL] |
- Item 5430486 15-Feb-90 09:58PST
-
- From: MUYSVASOVIC ACE - Jean-Denis Muys-Vasovic
-
- To: MACAPP.TECH$ MacApp Technical
-
- cc: RANSON France - Dev, Ranson Lannion,IDV
-
- Sub: PrintHandler in many views
-
- Hello folks, any idea about this one?
-
- My document is able to display the same data is lot of different manners in
- different windows. In DoMakeViews, I default to making, say, TView1. At any
- given time I may have TView1, Tview2, and TView3 open. All of them has a print
- handler, and should be able to print. The problem with TView3 is that it is
- located in the same window as an EditText which IS the target. The net effect
- is that when I choose print in the File menu, it is handled by the document who
- asks its handler to print, and its handler is the first one created, namely the
- one printing TView1.
-
- In short: TView3 is in front, and TView1 gets printed!!
-
- What would be the best solution to handle that? I don't want to insert the
- TView3 in the target chain. I tried the following too clever solution: I stuff
- the print handler in the window as well as the TView1 when TView1 is created:
-
- TMyDocument.CreateTheView(aCmdNumber: CmdNumber);
- BEGIN
- aWindow := NewTemplateWindow(aCmdNumber, SELF);
- aView := aWindow.FindSubView('work');
- FailNil(aView);
- New(aHandler);
- FailNil(aHandler);
- aHandler.IHandler(SELF, aView, …);
- aWindow.AttachPrintHandler(aHandler);
- END;
-
- This makes sense because the window is generally never printed as a window, and
- yet it is in the target chain. This "almost" works. What doesn't work is:
-
- TView.Free tries to free fPrintHandler if non-nil. The print handler is
- therefore freed twice. I suggest TView.Free would also test fPrintHandler.fView
- = SELF.
-
- At a number of circumstances, methods of TView use fPrintHandler for a number
- of things. These methods are usually not overriden in TWindow, but are harmless
- because TWindow.fPrintHandler is almost always nil. In my case the net result
- is AssumeFocused breaks a number of times!! (This also makes sense). However,
- if I go, the view gets printed correctly!!
-
- Suggestion: Allow for the same printhandler (to print a unique given view) to
- be attached to several views. This would only amounts to guard all the messages
- sent to fPrintHandler in TView by the test: IF fPrintHandler.fView = SELF THEN…
-
- Does all this make sense? Do you have any other solution which wouldn't involve
- modifying MacApp source code? Did I miss something obvious?
-
- With all my very best regards, I remain as much as James,
-
- Yours.
-
-
- Jean-Denis
-
-
-
-
-
-
-
-
-
-